package com.qyhl.webtv.module_news.news.comment;


import com.qyhl.webtv.commonlib.entity.intergral.CoinBean;
import com.qyhl.webtv.commonlib.entity.news.NormalNewsBean;

import java.util.List;

/**
 * Created by qyhl on 2017/11/30.
 */

public class CommentPresenter implements CommentContract.CommentPresenter {
    private CommentActivity mView;

    private CommentModel mModel;

    public CommentPresenter(CommentActivity mView) {
        this.mView = mView;
        this.mModel = new CommentModel(this);
    }

    @Override
    public void getComment(String newsId, String id) {
        mModel.getComment(newsId, id);
    }

    @Override
    public void sendComment(String title, String catalogId, String type, String id, String commentUser, String content) {
        mModel.sendComment(title, catalogId, type, id, commentUser, content);
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.showMessage(msg);
                break;
            case 2:
                mView.setEmpty(msg);
                break;
            case 3:
                mView.showLog(msg);
                break;
            case 4:
                mView.setError(msg);
                break;
            case 5:
                mView.showMessage(msg);
                break;
            default:break;
        }
    }

    @Override
    public void setComment(List<NormalNewsBean.ArticleComment> beanList, boolean isMore) {
        mView.setComment(beanList, isMore);
    }

    @Override
    public void sendError(String msg) {
        mView.sendError(msg);
    }

    @Override
    public void sendSuccess(String msg) {
        mView.sendSuccess(msg);
    }

    @Override
    public void getCoin() {
        mModel.getCoin();

    }

    @Override
    public void getCoinSuccess(CoinBean coinBean) {
        mView.getCoinSuccess(coinBean);
    }

    @Override
    public void getCoinError(String msg) {
        mView.getCoinError(msg);
    }
}
